<?php
/**
 * User:pan.liang
 * Date:2020/3/27
 * Time:15:37
 */
namespace app\admin\business\address;
use app\admin\model\address\School as SchoolModel;

class School{

    private $obj_school_model=null;
    public function __construct()
    {
        $this->obj_school_model = new SchoolModel();

    }

    /**
     * 添加reply
     * User:pan.liang
     * Date:2020/3/27
     * Time:15:37
     * @param $str_name
     * @return array
     */
    public function add($arr_add_data){
        $int_num=$this->obj_school_model->add($arr_add_data);
        if($int_num){
            $arr_add_data['id'] = $this->obj_school_model->getLastInsID();
            $arr_re=['ret'=>0,'reason'=>'success','data'=>$arr_add_data];
        }else{
            trace("添加reply失败",'error');
            $arr_re=['ret'=>1,'reason'=>'添加reply失败'];
        }
        return $arr_re;
    }

    /**
     * 修改reply
     * User:pan.liang
     * Date:2020/3/27
     * Time:15:37
     * @param $str_name
     * @return array
     */
    public function edit($mix_id,$arr_edit_data){
        $arr_where = (is_array($mix_id)) ? array(array('id','in',$mix_id),) : array(array('id','=',$mix_id),);
        $int_num=$this->obj_school_model->edit($arr_where,$arr_edit_data);
        if($int_num){
            $arr_re=['ret'=>0,'reason'=>'success'];
        }else{
            trace("修改reply失败",'error');
            $arr_re=['ret'=>1,'reason'=>'修改reply失败'];
        }
        return $arr_re;
    }

    /**
     * 删除reply
     * User:pan.liang
     * Date:2020/3/27
     * Time:15:37
     * @param $str_name
     * @return array
     */
    public function del($mix_id){
        $arr_where = (is_array($mix_id)) ? array(array('id','in',$mix_id),) : array(array('id','=',$mix_id),);
        $int_num=$this->obj_school_model->del($arr_where);
        if($int_num){
            $arr_re=['ret'=>0,'reason'=>'success'];
        }else{
            trace("删除reply失败",'error');
            $arr_re=['ret'=>1,'reason'=>'删除reply失败'];
        }
        return $arr_re;
    }

    public function queryData($arr_where){
        return $this->obj_school_model->queryData($arr_where);
    }

}